package com.tul.exercise.base.thread.exercise;

/**
 *
 * 练习题1
 */
class Prininfo implements Runnable {
    private String name;

    public Prininfo(String name) {
        this.name = name;
        System.out.println(name + " starting ...");
    }

    @Override
    public void run() {

        System.out.println(name + " Print info " + 1);
        Thread.yield();

        System.out.println(name + " Print info " + 2);
        Thread.yield();

        System.out.println(name + " Print info " + 3);
        Thread.yield();

        System.out.println(name + " end");

    }
}

public class Eg1 {
    public static void main(String[] args) {

        for (int i = 0; i < 10; i++) {
            (new Thread(new Prininfo("Task " + i))).start();
        }
    }
}
